home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / shared.dir / 03026_Script_ORIENTATION HANDLERS < prev    next >
Text File  |  1996-06-21  |  5KB  |  144 lines

  1. -- --------------------------------------------------------
  2. -- Handler setOrientationColors 
  3.  
  4. on setOrientationColors where
  5.   global color_WasThere, color_HereNow
  6.   
  7.   put where into field "Orientation"
  8.   
  9.   set the foreColor of field "Orientation" to color_WasThere
  10.   set the itemDelimiter to ":"
  11.   put the number of items of field "Orientation" into numItems
  12.   set the foreColor of item numItems of field "Orientation" to color_HereNow
  13.   set the itemDelimiter to ","
  14. end
  15.  
  16. -- --------------------------------------------------------
  17. -- Handler setOrientation 
  18.  
  19. on setOrientation scrollFlag
  20.   global blankSpaces, sectionOrientation, parentSection, color_WasThere,newOrientation
  21.   
  22.   set newOrientation = buildOrientation(sectionOrientation, parentSection)
  23.   set the foreColor of field "Orientation" to color_WasThere
  24.   
  25.   --    if scrollFlag then
  26.   --      set the itemDelimiter to ":"
  27.   --      put the number of items of newOrientation into numItems
  28.   --      
  29.   --      -- the following if statement in case there is only 1 item in the orientation.
  30.   --      -- this way, the item doesn't both appear and get scrolled.
  31.   --      if (numItems > 1) then
  32.   --        put item 1 to (numItems -1) of newOrientation into staticText
  33.   --      else
  34.   --        put EMPTY into staticText
  35.   --      end if
  36.   --      
  37.   --      put staticText & blankSpaces & item numItems of newOrientation into field "Orientation"
  38.   --      put length (staticText) + 1 into deletePos
  39.   --      set the itemDelimiter to ","
  40.   --      
  41.   --      repeat with extra = length(blankSpaces) down to 1
  42.   --        delete char deletePos of field "Orientation"
  43.   --      end repeat
  44.   --    end if
  45.   
  46.   setOrientationColors newOrientation
  47. end
  48.  
  49. -- --------------------------------------------------------
  50. -- Handler buildOrientation 
  51.  
  52. on buildOrientation sectionOrientation, parentName
  53.   set currentOrientation = sectionOrientation
  54.   
  55.   repeat while (parentName <> "0")
  56.     set parentOrientation = getParentOrientation(parentName)
  57.     if parentOrientation = "" then return currentOrientation
  58.     set currentOrientation = parentOrientation && ":" && currentOrientation
  59.     set parentName = getParentName(parentName)
  60.   end repeat
  61.   
  62.   return currentOrientation
  63. end
  64.  
  65. -- --------------------------------------------------------
  66. -- Handler getParentOrientation 
  67.  
  68. on getParentOrientation parentName
  69.   set parentSectionInfo = getSectionInfo(parentName)
  70.   if parentSectionInfo = "" then return "" -- ERROR
  71.   return getSectionOrientation(parentSectionInfo)
  72. end
  73.  
  74. -- --------------------------------------------------------
  75. -- Handler getParentName
  76.  
  77. on getParentName parentName
  78.   set parentSectionInfo = getSectionInfo(parentName)
  79.   if parentSectionInfo = "" then return "" -- ERROR
  80.   return getParentSection(parentSectionInfo)
  81. end
  82.  
  83. -- --------------------------------------------------------
  84. -- Handler clickOrientationText
  85.  
  86. on clickOrientationText
  87.   global currentSection,ancestor
  88.   if the mouseCast = the number of cast "Orientation" then
  89.     set the itemDelimiter to ":"
  90.     put the mouseItem into whichItem
  91.     
  92.     hiliteOrientationItem(whichItem)
  93.     set numItems = the number of items in field "Orientation"
  94.     
  95.     set the itemDelimiter to ","
  96.     if (whichItem = numItems) then
  97.       -- they clicked on the last item, just go to the beginning of the current section
  98.       -- this is used in cast the last item is just something like "example" and not
  99.       -- the name of a section
  100.       goSection(currentSection,0)
  101.     else
  102.       set ancestor = getAnscestor(whichItem, numItems, currentSection)
  103.       goSection(ancestor,0)
  104.     end if
  105.   end if
  106. end
  107.  
  108. -- --------------------------------------------------------
  109. -- Handler getAnscestor
  110.  
  111. on getAnscestor whichGeneration, numGenerations, currentSection
  112.   set prevGeneration = currentSection
  113.   
  114.   repeat with i = whichGeneration to (numGenerations - 1)
  115.     set parentName = getParentName(prevGeneration)
  116.     set prevGeneration = parentName
  117.   end repeat
  118.   
  119.   return prevGeneration
  120. end
  121.  
  122. -- --------------------------------------------------------
  123. -- Handler hiliteOrientationItem
  124.  
  125. on hiliteOrientationItem whichItem
  126.   --global hilitTextColor
  127.   
  128.   if item whichItem of field "Orientation" contains ":" then exit -- DEBUG
  129.   
  130.   set the foreColor of item whichItem of field "Orientation" = 186
  131.   
  132.   repeat while (not the mouseUp)
  133.     nothing -- to keep it hilited
  134.   end repeat
  135. end
  136.  
  137. -- --------------------------------------------------------
  138. -- Handler clearOrientationField
  139.  
  140. on clearOrientationField
  141.   put " " into field "Orientation"
  142. end
  143.  
  144.